<?php

namespace App\Http\Requests;

use App\Exceptions\ApiException;
use App\Exceptions\TeleException;
use Illuminate\Foundation\Http\FormRequest;

class AlishiFormRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'username'=>'required',
            'city'=>'required',
          //  'industry'=>'required',
            'mobile'=>'required',

        ];
    }
    public function messages()
    {
       return  [
            'username.required'=>'请填写名称',
            'city.required'=>'请填写城市名称',
           // 'industry.required'=>'请填写行业',
            'mobile.required'=>'请填写联系人',
             ];
    }
    protected function failedValidation(\Illuminate\Contracts\Validation\Validator $validator)
    {
        throw new ApiException($validator->errors()->first());
    }
}
